//
//  RecordViewController.m
//  wtshoppingcite
//
//  Created by TW on 15-2-2.
//  Copyright (c) 2015年 TW. All rights reserved.
//

#import "RecordViewController.h"
#import "NetServiseCommonData.h"
#import "RecordCell.h"
#import "RecordModel.h"
#import "DropDownListView.h"
#import "CustomDropButton.h"

@interface RecordViewController ()<UITableViewDataSource,UITableViewDelegate>

@property(nonatomic,strong)UITableView *recordTableView;
@property(nonatomic,strong)CustomDropButton *dropDownView;

@end

@implementation RecordViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    [self setTitleView:@"缴费记录"];
    
    UIView *view = [[UIView alloc]initWithFrame:CGRectMake(5, 5, kWidth, 40)];
    view.userInteractionEnabled = YES;
    
    
    _dataArray = [[NetServiseCommonData getRecordData]objectForKey:@"list"];
    _recordTableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 5, kWidth, kHeight-44)];
    _recordTableView.dataSource = self;
    _recordTableView.delegate = self;
    [self.view addSubview:_recordTableView];
    
    UILabel *lable = [[UILabel alloc]initWithFrame:CGRectMake(5, 5, 60, 30)];
    lable.text = @"全部";
    [view addSubview:lable];
    
    NSDictionary*dic = [[NSDictionary alloc]initWithObjectsAndKeys:@"123",@"name", nil];
    NSDictionary*dic1 = [[NSDictionary alloc]initWithObjectsAndKeys:@"1234",@"name", nil];
    
    NSArray* arr = @[dic,dic1];
    
    _dropDownView = [[CustomDropButton alloc] initWithFrame:CGRectMake(lable.right, 5 ,100,30) type:CUSTOMDROP_VIEW_TAG_VIEW_TAG_DEFAULT];
    [_dropDownView setTitle:@"选择省" forState:UIControlStateNormal];
    [_dropDownView setDropdownMenuViewWithData:arr frame:CGRectMake(_dropDownView.left, _dropDownView.bottom, _dropDownView.width, 140) inView:self.view];
    [view addSubview:_dropDownView];
    
    _recordTableView.tableHeaderView = view;
    
    
    // Do any additional setup after loading the view.
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}


-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section{
 
    return _dataArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
    RecordCell *cell = [tableView dequeueReusableCellWithIdentifier:@"recordCell"];
    if (cell == nil) {
        cell = [[RecordCell alloc]initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"recordCell"];
    }
    RecordModel *recordModel =[[RecordModel alloc ]initWithRecordList:_dataArray[indexPath.row]];
    cell.recordModel = recordModel;
    
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    
}

-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath{
    
    return 110;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    ;
}


- (void)viewWillDisappear:(BOOL)animated
{
    
    [super viewWillDisappear:animated];
    
    
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
